<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@taglib prefix="t" tagdir="/WEB-INF/tags"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>时光记录</title>
<t:link />
<script type="text/javascript" charset="utf-8"
	src="../static/utf8-jsp/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8"
	src="../static/utf8-jsp/ueditor.all.min.js">
	
</script>
<script type="text/javascript" charset="utf-8"
	src="../static/utf8-jsp/lang/zh-cn/zh-cn.js"></script>
<style type="text/css">
div {
	width: 100%;
}
</style>

</head>
<body>
	<div class="row">
		<div class="col-lg-12 col-sm-12 col-xs-12">
			<div class="widget">
				<div class="widget-header bordered-bottom bordered-blue">
					<span class="widget-caption">时光记录</span>
				</div>
				<div class="widget-body">
					<div id="horizontal-form">
						<form class="form-horizontal" role="form" action=""
							enctype="multipart/form-data" method="post">
							<input type="hidden" id="id" name="id"">
							<div class="form-group">
								<label for="username"
									class="col-sm-2 control-label no-padding-right">时光简介</label>
								<div class="col-sm-6">
									<input class="form-control" id="title" placeholder=""
										name="title" type="text">
								</div>
								<p class="help-block col-sm-4 red">必填</p>
							</div>
							<div class="form-group">
								<label for="group_id"
									class="col-sm-2 control-label no-padding-right">时光内容</label>
								<div class="col-sm-6">
									<script id="editor" type="text/plain"
										style="width:800px;height:300px;"></script>
									<%-- <jsp:include page="ueditor.jsp"></jsp:include> --%>
									<%-- <label> <textarea name="content" id="content"
											class="content"></textarea>
									</label> --%>
								</div>
							</div>
							<div class="form-group">
								<div class="col-sm-offset-2 col-sm-10">
									<button id="button" type="button" class="btn btn-default"
										style="color: blue;">保存信息</button>
								</div>
							</div>
						</form>
					</div>
				</div>
			</div>
		</div>
	</div>

</body>

<script type="text/javascript">
	//实例化编辑器
	 var ue = UE.getEditor('editor');
	 function getContent(){
		var arr = [];
		arr.push(UE.getEditor('editor').getContent());
		return arr.join("\n");
     }
</script>


<script type="text/javascript">
    

	$("#button").click(function() {
		var title = $("#title").val();
		var content = getContent();
		$.ajax({
			url : "${pageContext.request.contextPath}/myline/linesave",
			type : "POST",
			data : {
				title : title,
				content : content
			},
			success : function(data) {
				alert("保存成功!");
				window.open(
						"${pageContext.request.contextPath}/myline/index","_self");
			},
			error : function(data) {
				alert("保存失败!");
			}
		})

	})
</script>

</html>